3.1.96 \(\int (c+d x)^2 (a+a \sin (e+f x)) \, dx\) [96]

Optimal. Leaf size=68 \[ \frac {a (c+d x)^3}{3 d}+\frac {2 a d^2 \cos (e+f x)}{f^3}-\frac {a (c+d x)^2 \cos (e+f x)}{f}+\frac {2 a d (c+d x) \sin (e+f x)}{f^2} \]

[Out]

1/3*a*(d*x+c)^3/d+2*a*d^2*cos(f*x+e)/f^3-a*(d*x+c)^2*cos(f*x+e)/f+2*a*d*(d*x+c)*sin(f*x+e)/f^2

________________________________________________________________________________________

Rubi [A]
time = 0.06, antiderivative size = 68, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 3, integrand size = 18, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {3398, 3377, 2718} \begin {gather*} \frac {2 a d (c+d x) \sin (e+f x)}{f^2}-\frac {a (c+d x)^2 \cos (e+f x)}{f}+\frac {a (c+d x)^3}{3 d}+\frac {2 a d^2 \cos (e+f x)}{f^3} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(c + d*x)^2*(a + a*Sin[e + f*x]),x]

[Out]

(a*(c + d*x)^3)/(3*d) + (2*a*d^2*Cos[e + f*x])/f^3 - (a*(c + d*x)^2*Cos[e + f*x])/f + (2*a*d*(c + d*x)*Sin[e +
 f*x])/f^2

Rule 2718

Int[sin[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Cos[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3377

Int[((c_.) + (d_.)*(x_))^(m_.)*sin[(e_.) + (f_.)*(x_)], x_Symbol] :> Simp[(-(c + d*x)^m)*(Cos[e + f*x]/f), x]
+ Dist[d*(m/f), Int[(c + d*x)^(m - 1)*Cos[e + f*x], x], x] /; FreeQ[{c, d, e, f}, x] && GtQ[m, 0]

Rule 3398

Int[((c_.) + (d_.)*(x_))^(m_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Int[ExpandIntegrand[
(c + d*x)^m, (a + b*Sin[e + f*x])^n, x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IGtQ[n, 0] && (EqQ[n, 1] ||
IGtQ[m, 0] || NeQ[a^2 - b^2, 0])

Rubi steps

\begin {align*} \int (c+d x)^2 (a+a \sin (e+f x)) \, dx &=\int \left (a (c+d x)^2+a (c+d x)^2 \sin (e+f x)\right ) \, dx\\ &=\frac {a (c+d x)^3}{3 d}+a \int (c+d x)^2 \sin (e+f x) \, dx\\ &=\frac {a (c+d x)^3}{3 d}-\frac {a (c+d x)^2 \cos (e+f x)}{f}+\frac {(2 a d) \int (c+d x) \cos (e+f x) \, dx}{f}\\ &=\frac {a (c+d x)^3}{3 d}-\frac {a (c+d x)^2 \cos (e+f x)}{f}+\frac {2 a d (c+d x) \sin (e+f x)}{f^2}-\frac {\left (2 a d^2\right ) \int \sin (e+f x) \, dx}{f^2}\\ &=\frac {a (c+d x)^3}{3 d}+\frac {2 a d^2 \cos (e+f x)}{f^3}-\frac {a (c+d x)^2 \cos (e+f x)}{f}+\frac {2 a d (c+d x) \sin (e+f x)}{f^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.24, size = 81, normalized size = 1.19 \begin {gather*} a \left (c^2 x+c d x^2+\frac {d^2 x^3}{3}-\frac {\left (c^2 f^2+2 c d f^2 x+d^2 \left (-2+f^2 x^2\right )\right ) \cos (e+f x)}{f^3}+\frac {2 d (c+d x) \sin (e+f x)}{f^2}\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(c + d*x)^2*(a + a*Sin[e + f*x]),x]

[Out]

a*(c^2*x + c*d*x^2 + (d^2*x^3)/3 - ((c^2*f^2 + 2*c*d*f^2*x + d^2*(-2 + f^2*x^2))*Cos[e + f*x])/f^3 + (2*d*(c +
 d*x)*Sin[e + f*x])/f^2)

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(240\) vs. \(2(66)=132\).
time = 0.05, size = 241, normalized size = 3.54

method result size
risch \(\frac {a \,d^{2} x^{3}}{3}+a d c \,x^{2}+a \,c^{2} x +\frac {a \,c^{3}}{3 d}-\frac {a \left (d^{2} x^{2} f^{2}+2 c d \,f^{2} x +c^{2} f^{2}-2 d^{2}\right ) \cos \left (f x +e \right )}{f^{3}}+\frac {2 a d \left (d x +c \right ) \sin \left (f x +e \right )}{f^{2}}\) \(94\)
norman \(\frac {\frac {\left (2 a \,c^{2} f^{2}-4 a \,d^{2}\right ) \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f^{3}}+\frac {a c \left (c f -2 d \right ) x}{f}+\frac {d a \left (c f -d \right ) x^{2}}{f}+\frac {a c \left (c f +2 d \right ) x \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}+\frac {d a \left (c f +d \right ) x^{2} \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}+\frac {a \,d^{2} x^{3}}{3}+\frac {a \,d^{2} x^{3} \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{3}+\frac {4 a c d \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{f^{2}}+\frac {4 a \,d^{2} x \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{f^{2}}}{1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )}\) \(194\)
derivativedivides \(\frac {-a \,c^{2} \cos \left (f x +e \right )+\frac {2 a c d e \cos \left (f x +e \right )}{f}+\frac {2 a c d \left (\sin \left (f x +e \right )-\left (f x +e \right ) \cos \left (f x +e \right )\right )}{f}-\frac {a \,d^{2} e^{2} \cos \left (f x +e \right )}{f^{2}}-\frac {2 a \,d^{2} e \left (\sin \left (f x +e \right )-\left (f x +e \right ) \cos \left (f x +e \right )\right )}{f^{2}}+\frac {a \,d^{2} \left (-\left (f x +e \right )^{2} \cos \left (f x +e \right )+2 \cos \left (f x +e \right )+2 \left (f x +e \right ) \sin \left (f x +e \right )\right )}{f^{2}}+a \,c^{2} \left (f x +e \right )-\frac {2 a c d e \left (f x +e \right )}{f}+\frac {a c d \left (f x +e \right )^{2}}{f}+\frac {a \,d^{2} e^{2} \left (f x +e \right )}{f^{2}}-\frac {a \,d^{2} e \left (f x +e \right )^{2}}{f^{2}}+\frac {a \,d^{2} \left (f x +e \right )^{3}}{3 f^{2}}}{f}\) \(241\)
default \(\frac {-a \,c^{2} \cos \left (f x +e \right )+\frac {2 a c d e \cos \left (f x +e \right )}{f}+\frac {2 a c d \left (\sin \left (f x +e \right )-\left (f x +e \right ) \cos \left (f x +e \right )\right )}{f}-\frac {a \,d^{2} e^{2} \cos \left (f x +e \right )}{f^{2}}-\frac {2 a \,d^{2} e \left (\sin \left (f x +e \right )-\left (f x +e \right ) \cos \left (f x +e \right )\right )}{f^{2}}+\frac {a \,d^{2} \left (-\left (f x +e \right )^{2} \cos \left (f x +e \right )+2 \cos \left (f x +e \right )+2 \left (f x +e \right ) \sin \left (f x +e \right )\right )}{f^{2}}+a \,c^{2} \left (f x +e \right )-\frac {2 a c d e \left (f x +e \right )}{f}+\frac {a c d \left (f x +e \right )^{2}}{f}+\frac {a \,d^{2} e^{2} \left (f x +e \right )}{f^{2}}-\frac {a \,d^{2} e \left (f x +e \right )^{2}}{f^{2}}+\frac {a \,d^{2} \left (f x +e \right )^{3}}{3 f^{2}}}{f}\) \(241\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*x+c)^2*(a+a*sin(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

1/f*(-a*c^2*cos(f*x+e)+2*a/f*c*d*e*cos(f*x+e)+2*a/f*c*d*(sin(f*x+e)-(f*x+e)*cos(f*x+e))-a/f^2*d^2*e^2*cos(f*x+
e)-2*a/f^2*d^2*e*(sin(f*x+e)-(f*x+e)*cos(f*x+e))+a/f^2*d^2*(-(f*x+e)^2*cos(f*x+e)+2*cos(f*x+e)+2*(f*x+e)*sin(f
*x+e))+a*c^2*(f*x+e)-2*a/f*c*d*e*(f*x+e)+a/f*c*d*(f*x+e)^2+a/f^2*d^2*e^2*(f*x+e)-a/f^2*d^2*e*(f*x+e)^2+1/3*a/f
^2*d^2*(f*x+e)^3)

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 260 vs. \(2 (69) = 138\).
time = 0.30, size = 260, normalized size = 3.82 \begin {gather*} \frac {3 \, {\left (f x + e\right )} a c^{2} + \frac {{\left (f x + e\right )}^{3} a d^{2}}{f^{2}} + \frac {3 \, {\left (f x + e\right )}^{2} a c d}{f} - 3 \, a c^{2} \cos \left (f x + e\right ) - \frac {3 \, {\left (f x + e\right )}^{2} a d^{2} e}{f^{2}} - \frac {6 \, {\left (f x + e\right )} a c d e}{f} + \frac {6 \, a c d \cos \left (f x + e\right ) e}{f} - \frac {6 \, {\left ({\left (f x + e\right )} \cos \left (f x + e\right ) - \sin \left (f x + e\right )\right )} a c d}{f} + \frac {3 \, {\left (f x + e\right )} a d^{2} e^{2}}{f^{2}} - \frac {3 \, a d^{2} \cos \left (f x + e\right ) e^{2}}{f^{2}} + \frac {6 \, {\left ({\left (f x + e\right )} \cos \left (f x + e\right ) - \sin \left (f x + e\right )\right )} a d^{2} e}{f^{2}} - \frac {3 \, {\left ({\left ({\left (f x + e\right )}^{2} - 2\right )} \cos \left (f x + e\right ) - 2 \, {\left (f x + e\right )} \sin \left (f x + e\right )\right )} a d^{2}}{f^{2}}}{3 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2*(a+a*sin(f*x+e)),x, algorithm="maxima")

[Out]

1/3*(3*(f*x + e)*a*c^2 + (f*x + e)^3*a*d^2/f^2 + 3*(f*x + e)^2*a*c*d/f - 3*a*c^2*cos(f*x + e) - 3*(f*x + e)^2*
a*d^2*e/f^2 - 6*(f*x + e)*a*c*d*e/f + 6*a*c*d*cos(f*x + e)*e/f - 6*((f*x + e)*cos(f*x + e) - sin(f*x + e))*a*c
*d/f + 3*(f*x + e)*a*d^2*e^2/f^2 - 3*a*d^2*cos(f*x + e)*e^2/f^2 + 6*((f*x + e)*cos(f*x + e) - sin(f*x + e))*a*
d^2*e/f^2 - 3*(((f*x + e)^2 - 2)*cos(f*x + e) - 2*(f*x + e)*sin(f*x + e))*a*d^2/f^2)/f

________________________________________________________________________________________

Fricas [A]
time = 0.36, size = 104, normalized size = 1.53 \begin {gather*} \frac {a d^{2} f^{3} x^{3} + 3 \, a c d f^{3} x^{2} + 3 \, a c^{2} f^{3} x - 3 \, {\left (a d^{2} f^{2} x^{2} + 2 \, a c d f^{2} x + a c^{2} f^{2} - 2 \, a d^{2}\right )} \cos \left (f x + e\right ) + 6 \, {\left (a d^{2} f x + a c d f\right )} \sin \left (f x + e\right )}{3 \, f^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2*(a+a*sin(f*x+e)),x, algorithm="fricas")

[Out]

1/3*(a*d^2*f^3*x^3 + 3*a*c*d*f^3*x^2 + 3*a*c^2*f^3*x - 3*(a*d^2*f^2*x^2 + 2*a*c*d*f^2*x + a*c^2*f^2 - 2*a*d^2)
*cos(f*x + e) + 6*(a*d^2*f*x + a*c*d*f)*sin(f*x + e))/f^3

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 151 vs. \(2 (65) = 130\).
time = 0.15, size = 151, normalized size = 2.22 \begin {gather*} \begin {cases} a c^{2} x - \frac {a c^{2} \cos {\left (e + f x \right )}}{f} + a c d x^{2} - \frac {2 a c d x \cos {\left (e + f x \right )}}{f} + \frac {2 a c d \sin {\left (e + f x \right )}}{f^{2}} + \frac {a d^{2} x^{3}}{3} - \frac {a d^{2} x^{2} \cos {\left (e + f x \right )}}{f} + \frac {2 a d^{2} x \sin {\left (e + f x \right )}}{f^{2}} + \frac {2 a d^{2} \cos {\left (e + f x \right )}}{f^{3}} & \text {for}\: f \neq 0 \\\left (a \sin {\left (e \right )} + a\right ) \left (c^{2} x + c d x^{2} + \frac {d^{2} x^{3}}{3}\right ) & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)**2*(a+a*sin(f*x+e)),x)

[Out]

Piecewise((a*c**2*x - a*c**2*cos(e + f*x)/f + a*c*d*x**2 - 2*a*c*d*x*cos(e + f*x)/f + 2*a*c*d*sin(e + f*x)/f**
2 + a*d**2*x**3/3 - a*d**2*x**2*cos(e + f*x)/f + 2*a*d**2*x*sin(e + f*x)/f**2 + 2*a*d**2*cos(e + f*x)/f**3, Ne
(f, 0)), ((a*sin(e) + a)*(c**2*x + c*d*x**2 + d**2*x**3/3), True))

________________________________________________________________________________________

Giac [A]
time = 2.63, size = 95, normalized size = 1.40 \begin {gather*} \frac {1}{3} \, a d^{2} x^{3} + a c d x^{2} + a c^{2} x - \frac {{\left (a d^{2} f^{2} x^{2} + 2 \, a c d f^{2} x + a c^{2} f^{2} - 2 \, a d^{2}\right )} \cos \left (f x + e\right )}{f^{3}} + \frac {2 \, {\left (a d^{2} f x + a c d f\right )} \sin \left (f x + e\right )}{f^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2*(a+a*sin(f*x+e)),x, algorithm="giac")

[Out]

1/3*a*d^2*x^3 + a*c*d*x^2 + a*c^2*x - (a*d^2*f^2*x^2 + 2*a*c*d*f^2*x + a*c^2*f^2 - 2*a*d^2)*cos(f*x + e)/f^3 +
 2*(a*d^2*f*x + a*c*d*f)*sin(f*x + e)/f^3

________________________________________________________________________________________

Mupad [B]
time = 0.15, size = 112, normalized size = 1.65 \begin {gather*} \frac {a\,d^2\,x^3}{3}+\frac {\cos \left (e+f\,x\right )\,\left (2\,a\,d^2-a\,c^2\,f^2\right )}{f^3}+a\,c^2\,x+a\,c\,d\,x^2+\frac {2\,a\,d^2\,x\,\sin \left (e+f\,x\right )}{f^2}-\frac {a\,d^2\,x^2\,\cos \left (e+f\,x\right )}{f}+\frac {2\,a\,c\,d\,\sin \left (e+f\,x\right )}{f^2}-\frac {2\,a\,c\,d\,x\,\cos \left (e+f\,x\right )}{f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + a*sin(e + f*x))*(c + d*x)^2,x)

[Out]

(a*d^2*x^3)/3 + (cos(e + f*x)*(2*a*d^2 - a*c^2*f^2))/f^3 + a*c^2*x + a*c*d*x^2 + (2*a*d^2*x*sin(e + f*x))/f^2
- (a*d^2*x^2*cos(e + f*x))/f + (2*a*c*d*sin(e + f*x))/f^2 - (2*a*c*d*x*cos(e + f*x))/f

________________________________________________________________________________________